<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/view/include/inc.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
<%@ include file="/WEB-INF/view/jQgrid.jsp"%>
<title>${resume.trueName}_人才详情</title>
<script src="<%=contextPath%>/js/zDialog.js"></script>
<script src="<%=contextPath%>/js/zDrag.js"></script>
</head>
<body>
	<div class="container-fluid" id="main-container">
	    <input type="hidden" id="id" value="${resume.id}">
	    <input type="hidden" id="position" value="${resume.position}">
		<div id="page-content" class="clearfix">
			<div class="row-fluid">
				<div class="col-sm-12" style="margin-top: 20px;">
					<div class="col-sm-6" style="padding-left: 50px;line-height:30px;">
						<h3 ><i class="icon-user"></i> 基本信息</h3>
					</div>
					<div class="col-sm-6" style="padding-right: 50px;float: right;text-align: right;">
						<div class="form-group">
							<%-- <a class="btn btn-primary">原始简历</a>&nbsp;&nbsp;--%>
							<a onclick="openedit();" class="btn btn-warning">修改</a>
						</div>
					</div>
				</div>
				<div class="col-sm-12">
					<table border="1" class="table table-bordered">
						<tbody>
							<tr>
								<td width="15%">
									<p align="right">真实姓名:</p>
								</td>
								<td width="15%">
									<p>${resume.trueName }</p>
								</td>
								<td width="15%">
									<p align="right">手机号码:</p>
								</td>
								<td width="15%">
									<p>${resume.phoneview }</p>
								</td>
								<td width="15%">
									<p align="right">性别:</p>
								</td >
								<td width="15%">
									<p>${fns:getDictLabel(resume.sex,'resume_sex','')}</p>
								</td>
							</tr>
							<tr>
								<td>
									<p align="right">出生年月:</p>
								</td>
								<td>
									<p>${resume.birthdate }</p>
								</td>
								<td>
									<p align="right">邮箱:</p>
								</td>
								<td>
									<p>${resume.email }</p>
								</td>
								<td>
									<p align="right">目前居住地:</p>
								</td>
								<td>
									<p>${resume.locationArea.treeNames }</p>
								</td>
							</tr>
							<tr>
								<td>
									<p align="right">期望工作地:</p>
								</td>
								<td>
									<p>${resume.expectedCityNames }</p>
								</td>
								<td>
									<p align="right">目前薪酬:</p>
								</td>
								<td>
									<p>${resume.emolument }万人民币，其中基本年薪${resume.basicSalary }万人民币，奖金${resume.bonus}万人民币，期权/股权${resume.equity }</p>
								</td>
								<td>
									<p align="right">期望薪酬:</p>
								</td>
								<td>
									<p>${resume.expectSalarystart }-${resume.expectSalaryend }（万人民币）</p>
								</td>
							</tr>
							<tr>
								<td>
									<p align="right">第一学历:</p>
								</td>
								<td>
									<p>${resume.education }</p>
								</td>
								<td>
									<p align="right">专业:</p>
								</td>
								<td>
									<p>${resume.profession }</p>
								</td>
								<td>
									<p align="right"></p>
								</td>
								<td>
									<p></p>
								</td>
							</tr>
						</tbody>
					</table>

				</div>
			</div>
			<div class="row-fluid">
				<div class="col-sm-12">
					<div class="tabbable" id="tabs-94850">
						<ul class="nav nav-tabs">
							<li class="active">
								<a href="#panel-jyjl" data-toggle="tab">教育经历(<font color="red">${schoolcount}</font>)</a>
							</li>
							<li>
								<a href="#panel-zgzs" data-toggle="tab">资格证书(<font color="red">${certificatecount}</font>)</a>
							</li>
							<li>
								<a href="#panel-gzjj" data-toggle="tab">工作经历(<font color="red">${workcount}</font>)</a>
							</li>
							<li>
								<a href="#panel-pxjj" data-toggle="tab">培训经历(<font color="red">${traincount}</font>)</a>
							</li>
						</ul>
						<div class="tab-content">
							<div class="tab-pane active" id="panel-jyjl">
							<div class="col-sm-6" style="padding-right: 50px;float: left;margin-top: 15px;">
								<div class="form-group">
									<button type="button" class="btn-sm btn-primary" onclick="addedu();">添加</button>
								</div>
							</div>
								<table class="table table-bordered">
									<thead>
										<tr>
											<th>起止日期</th>
											<th>学校名称</th>
											<th>专业</th>
											<th>学历</th>
											<th>是否统招</th>
											<th>创建时间</th>
											<th>修改时间</th>
											<th>修改人</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody>
									<c:forEach items="${schools }" var="schoolexp">
										<tr>
											<td>${schoolexp.startDate } 至 ${schoolexp.endDate }</td>
											<c:choose>
												<c:when test="${not empty schoolexp.school.name}">
													<td>${schoolexp.school.name }</td>
												</c:when>
												<c:otherwise> 
													<td>${schoolexp.schoolName }</td>
												</c:otherwise>
											</c:choose>
											<td>${schoolexp.profession }</td>
											<td>${schoolexp.education } </td>
											<td><c:if test="${schoolexp.unified==1 }">是</c:if><c:if test="${schoolexp.unified==0 }">否</c:if></td>
											<td>${schoolexp.createDate }</td>
											<td>${schoolexp.updateDate }</td>
											<td>${schoolexp.updateUser.truename}</td>
											<td><a class="btn-sm btn-warning" onclick="addedu();">继续添加</a>&nbsp;&nbsp;<a class="btn-sm btn-danger" onclick="editedu(&quot;${schoolexp.id }&quot;);">修改</a></td>
										</tr>
										</c:forEach>
									</tbody>
								</table>
							</div>
							<div class="tab-pane" id="panel-zgzs">
							   <div class="col-sm-6" style="padding-right: 50px;float: left;margin-top: 15px;">
									<div class="form-group">
										<button type="button" class="btn-sm btn-primary" onclick="addzgzs();">添加</button>
									</div>
								</div>
								<table class="table table-bordered">
									<thead>
										<tr>
											<th>证书名称</th>
											<th>创建时间</th>
											<th>修改时间</th>
											<th>修改人</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody>
									<c:forEach items="${certificates }" var="certificate">
										<tr>
											<td>${certificate.name  }</td>
											<td>${certificate.createDate }</td>
											<td>${certificate.updateDate }</td>
											<td>${certificate.updateUser.truename }</td>
											<td><a class="btn-sm btn-warning" onclick="addzgzs();">继续添加</a>&nbsp;&nbsp;<a class="btn-sm btn-danger" onclick="editzgzs(&quot;${certificate.id }&quot;);">修改</a></td>
										</tr>
										</c:forEach>
									</tbody>
								</table>
							</div>
							<div class="tab-pane" id="panel-gzjj">
							    <div class="col-sm-6" style="padding-right: 50px;float: left;margin-top: 15px;">
									<div class="form-group">
										<button type="button" class="btn-sm btn-primary" onclick="addwork();">添加</button>
									</div>
								</div>
								<table class="table table-bordered">
									<thead>
										<tr>
											<th>任职时间</th>
											<th>公司名称</th>
											<th>岗位名称</th>
											<th>创建时间</th>
											<th>修改时间</th>
											<th>修改人</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody>
									<c:forEach items="${workExperiences }" var="workexp">
										<tr>
											<td>${workexp.startDate }至${workexp.endDate }</td>
											<td>${workexp.companyName }</td>
											<td>${workexp.position }</td>
											<td>${workexp.createDate }</td>
											<td>${workexp.updateDate }</td>
											<td>${workexp.updateUser.truename }</td>
											<td><a class="btn-sm btn-warning" onclick="addwork();">继续添加</a>&nbsp;&nbsp;<a class="btn-sm btn-danger" onclick="editwork(&quot;${workexp.id }&quot;);">修改</a></td>
										</tr>
										</c:forEach>
									</tbody>
								</table>
							</div>
							<div class="tab-pane" id="panel-pxjj">
							   <div class="col-sm-6" style="padding-right: 50px;float: left;margin-top: 15px;">
									<div class="form-group">
										<button type="button" class="btn-sm btn-primary" onclick="addtrain();">添加</button>
									</div>
								</div>
								<table class="table table-bordered">
									<thead>
										<tr>
											<th>起止日期</th>
											<th>培训机构</th>
											<th>培训课程</th>
											<th>获得证书</th>
											<th>创建时间</th>
											<th>修改时间</th>
											<th>修改人</th>
											<th>操作</th>
										</tr>
									</thead>
									<tbody>
									<c:forEach items="${trains }" var="trainexp">
										<tr>
											<td>${trainexp.startDate } 至 ${trainexp.endDate }</td>
											<td>${trainexp.school.name  }</td>
											<td>${trainexp.course  }</td>
											<td>${trainexp.grade  }</td>
											<td>${trainexp.createDate }</td>
											<td>${trainexp.updateDate }</td>
											<td>${trainexp.updateUser.truename }</td>
											<td><a class="btn-sm btn-warning" onclick="addtrain();">继续添加</a>&nbsp;&nbsp;<a class="btn-sm btn-danger" onclick="edittrain(&quot;${trainexp.id }&quot;);">修改</a></td>
										</tr>
										</c:forEach>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
			<div class="row-fluid">
				<div class="col-sm-12">
					<div class="col-sm-6" style="padding-left: 50px;line-height:30px;">
						<h3 ><i class="icon-external-link"></i> 推荐记录(<font color="red">${recommendcount}</font>)</h3>
					</div>
					<div class="col-sm-6" style="padding-right: 50px;float: right;text-align: right;">
						<div class="form-group">
							<button type="button" class="btn-sm btn-info" onclick="addrecommend();">添加</button>
						</div>
					</div>
				</div>
				<div class="col-sm-12">
					<table class="table table-bordered">
						<thead>
							<tr>
								<th>公司名称</th>
								<th>岗位名称</th>
								<th>企业对接人</th>
								<th>联系电话</th>
								<th>推荐状态</th>
								<th>沟通记录</th>
								<th>推荐时间</th>
								<th>推荐人</th>
								<th>是否通过</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
						<c:forEach items="${recommends }" var="recommend">
						   <tr>
								<td><a onclick="opencompany(&quot;${recommend.companyId }&quot;)">${recommend.company.name }</a></td>
								<td><a onclick="openposts(&quot;${recommend.demandId }&quot;)">${recommend.dEnterprise.positionName}</a></td>
								<td>${recommend.enpPeople.trueName}</td>
								<td>${recommend.enpPeople.cellphone}</td>
								<td><a onclick="openresult(&quot;${recommend.id}&quot;,&quot;${recommend.companyId}&quot;);" class="btn-sm btn-warning">${fns:getDictLabel(recommend.status,'rec_status','')}</a></td>
								<td><a onclick="openrecord(&quot;${recommend.id}&quot;);" class="btm-sm btn-link">查看详请</a></td>
								<td>${recommend.createDate}</td>
								<td>${recommend.createUser.truename}</td>
								<td>
								     <c:if test="${recommend.isPast eq 0}"><span class='label label-default'>未反馈</span></c:if>
								     <c:if test="${recommend.isPast eq 1}"><span class='label label-success'>是</span></c:if>
								     <c:if test="${recommend.isPast eq 2}"><span class='label label-danger'>否</span></c:if>
								</td>
								<td>
								    <a class="btn-sm btn-danger" onclick="addrecommend();">继续推荐</a>&nbsp;&nbsp;
								    <c:if test="${recommend.isPast eq 0}">
								    <a class="btn-sm btn-primary" onclick="addfeedback(&quot;${recommend.id}&quot;,&quot;${recommend.companyId}&quot;,&quot;${recommend.demandId }&quot;);">反馈结果</a>&nbsp;&nbsp;
								    </c:if>
								    <a class="btn-sm btn-info" onclick="downreport(&quot;${recommend.reportFile }&quot;);">下载</a>
								    <a class="btn-sm btn-info" onclick="timeline(&quot;${recommend.id }&quot;);">沟通环节</a>
								</td>
							</tr>
						</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
			<div class="row-fluid">
				<div class="col-sm-12">
					<div class="col-sm-6" style="padding-left: 50px;line-height:30px;">
						<h3 ><i class="icon-comments"></i> 沟通记录(<font color="red">${communicatecount}</font>)</h3>
					</div>
					<div class="col-sm-6" style="padding-right: 50px;float: right;text-align: right;">
						<div class="form-group">
							<button type="button" class="btn-sm btn-info" onclick="addcommunicate();">添加</button>
						</div>
					</div>
				</div>
				<div class="col-sm-12">
					<table class="table table-bordered">
						<thead>
							<tr>
								<th>姓名</th>
								<th>联系方式</th>
								<th>沟通方式</th>
								<th>沟通目的</th>
								<th>意向性</th>
								<th>沟通内容</th>
								<th>沟通时间</th>
								<th>沟通人</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
						<c:forEach items="${communicates }" var="communicate">
							<tr>
								<td>${resume.trueName }</td>
								<td>${resume.cellphone }</td>
								<td>${communicate.methods }</td>
								<td>${communicate.purpose }</td>
								<td>${communicate.intentionality }</td>
								<td>${communicate.details }</td>
								<td>${communicate.createDate }</td>
								<td>${communicate.userupdate.truename }</td>
								<td><a class="btn-sm btn-danger" onclick="addcommunicate();">继续沟通</a></td>
							</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
			<div class="row-fluid">
				<div class="col-sm-12">
					<div class="col-sm-6" style="padding-left: 50px;line-height:30px;">
						<h3 ><i class="icon-comments"></i> 人脉关系(<font color="red">${relationshipscount}</font>)</h3>
					</div>
					<div class="col-sm-6" style="padding-right: 50px;float: right;text-align: right;">
						<div class="form-group">
							<button type="button" class="btn-sm btn-info" onclick="addrelation();">一键生成</button>
						</div>
					</div>
				</div>
				<div class="col-sm-12">
					<table class="table table-bordered">
						<thead>
							<tr>
								<th>姓名</th>
								<th>人物关系</th>
								<th>添加时间</th>
								<th>添加人</th>
								<th>操作</th>
							</tr>
						</thead>
						<tbody>
						<c:forEach items="${relationships }" var="relationship">
							<tr>
								<td><a onclick="openresume(&quot;${relationship.resumeRelationId }&quot;)">${relationship.name }</a></td>
								<td>${fns:getDictLabel(relationship.relationId,'resume_relation','')}</td>
								<td>${relationship.createDate }</td>
								<td>${relationship.createUser.truename }</td>
								<td><a class="btn-sm btn-danger" onclick="addrelation();">继续添加</a></td>
							</tr>
							</c:forEach>
						</tbody>
					</table>
				</div>
			</div>
				</div>
				<!-- PAGE CONTENT ENDS HERE -->

			</div>
			<!--/row-->
		</div>
		<!--/#page-content-->
	</div>
	<!--/.fluid-container#main-container-->
	<script type="text/javascript">
	var talentsId = $("#id").val();
	var position = $("#position").val();
	function opencompany(id) {
		window.open("<%=contextPath%>/company/detailView?id=" + id);
	}
	function openposts(id) {
		window.open("<%=contextPath%>/demandEnterprise/detailView?id=" + id);
	}
	function addedu() {
		openwindow("添加教育经历", "<%=contextPath%>/edu/addView?talents_id=" + talentsId+"&num=1", 800, 550);
	}
	function editedu(id) {
		openwindow("修改教育经历", "<%=contextPath%>/edu/editSingleView?id=" + id+"&num=1", 800, 550);
	}
	function addrecommend() {
		openwindow("添加人才推荐", "<%=contextPath%>/talentsRecommend/addView?talentsId=" + talentsId +"&position="+position, 800, 550);
	}
	function addcommunicate() {
		openwindow("添加沟通记录", "<%=contextPath%>/demandCommunicate/addView?talentsId=" + talentsId, 500, 550);
	}
	function addzgzs() {
		openwindow("添加资格证书", "<%=contextPath%>/tbCertificate/addView?talentsId=" + talentsId, 500, 300);
	}
	function editzgzs(id) {
		openwindow("修改资格证书", "<%=contextPath%>/tbCertificate/editView?id=" + id, 500, 300);
	}
	function addwork() {
		openwindow("添加工作经历", "<%=contextPath%>/work/addView?talents_id=" + talentsId, 850, 750);
	}
	function editwork(id) {
		openwindow("修改工作经历", "<%=contextPath%>/work/editSingleView?id=" + id, 850, 750);
	}
	function addtrain() {
		openwindow("添加培训经历", "<%=contextPath%>/edu/addView?talents_id=" + talentsId+"&num=2", 800, 550);
	}
	function edittrain(id) {
		openwindow("修改培训经历", "<%=contextPath%>/edu/editSingleView?id=" + id+"&num=2", 800, 550);
	}
	function addfeedback(recommendId,companyId,demandId) {
		swal({ 
			title: "该人才是否合适？", 
			type: "warning", 
			showCancelButton: true, 
			confirmButtonColor: "#DD6B55", 
			confirmButtonText: "No", 
			cancelButtonText: "Yes", 
			closeOnConfirm: false, 
			closeOnCancel: false 
			}, 
			function(isConfirm) { 
				if (isConfirm) { 
					swal({
   		    			title:"即将进入下一环节",
   		    			text: "1秒后自动关闭。", 
   		    			timer: 1000, 
   					    showConfirmButton: false
   		    		});
					openwindow("反馈推荐结果", "<%=contextPath%>/recommendResult/addView?recommendId=" + recommendId +"&companyId=" + companyId, 600, 500);
					} else{ 
						swal({
       		    			title:"即将进入下一环节",
       		    			text: "1秒后自动关闭。", 
       		    			timer: 1000, 
       					    showConfirmButton: false
       		    		});
						updateStatus(recommendId,1);
						openwindow("添加沟通记录", "<%=contextPath%>/demandCommunicate/addView?talentsId=" + talentsId+"&recommendId=" + recommendId +"&companyId=" + companyId+"&demandId="+demandId, 500, 550);
						
					} 
				})
	}
	function openrecord(recommendId) {
		openwindow("查看沟通记录", "<%=contextPath%>/demandCommunicate/list?recommendId=" + recommendId+"&talentsId=" + talentsId, 1080, 550);
	}
	function addrecord(recommendId,companyId) {
		openwindow("添加沟通记录", "<%=contextPath%>/demandCommunicate/addView?talentsId=" + talentsId+"&recommendId=" + recommendId +"&companyId=" + companyId, 500, 550);
	}
	function openresult(recommendId,companyId) {
		openwindow("查看推荐结果", "<%=contextPath%>/recommendResult/resultView?recommendId=" + recommendId +"&companyId=" + companyId, 800, 600);
	}
	function addrelation() {
		$.ajax({
            url: "<%=contextPath%>/relationship/addBatch",
            data: {'talentsId':talentsId},
            type: "post",
            dataType: "json",
            success: function (data) {
            	if (data.code == 200) {
					swal({
						title : data.message,
						type : "success",
						showCancelButton : false,
						confirmButtonText : "确定",
						animation : "slide-from-bottom",
						text: "2秒后自动关闭。", 
      	    			timer: 2000, 
						closeOnConfirm : true
					})
					document.location.reload();
				} else {
					swal("错误", data.message, "error");
				} 
            },
        }) 
	}
	function downreport(file){
		var doc = '<%=contextPath%>'+file; 
		var triggerDownload = $("<a>").attr("href", doc).attr("download", doc).appendTo("body"); 
   	    triggerDownload[0].click(); 
        triggerDownload.remove();
	}
	function openedit() {
		openwindow("修改人才","<%=contextPath%>/resume/editView?id="+talentsId+"&tops=1",1080,850);
	}
	function openresume(id) {
		window.open("<%=contextPath%>/resume/detailView?id=" + id);
	}
	function timeline(id) {
		openwindow("沟通时间轴","<%=contextPath%>/talentsRecommend/timeLine?id="+id,1080,550);
	}
	function updateStatus(id,status){
		$.ajax({
			url:'<%=contextPath%>/talentsRecommend/updateStatus',
			data:{
				"id":id,
				"ispast":status
			},
				type : 'post',
				dataType : "json",
			success : function(data) {
				if (data.code == 200) {
					swal({
						title : data.message,
						type : "success",
						showCancelButton : false,
						confirmButtonText : "确定",
						animation : "slide-from-bottom",
						text: "2秒后自动关闭。", 
      	    			timer: 2000, 
						closeOnConfirm : true
					}, function() {
						top.Dialog.close();
					});
				} else {
					swal("错误", data.message, "error");
				} 
			}
		});
	}
	function openwindow(title,url,width,height){
	 var diag = new Dialog();
	 diag.Drag=true;
	 diag.Title =title;
	 diag.URL = url;
	 diag.Width = width;
	 diag.Height = height;
	 diag.CancelEvent = function(){ //关闭事件
		document.location.reload();
		diag.close();
	 };
	 diag.show();
}//是通过这个方法打开的子窗体
	</script>
</body>
</html>

